package com.hy.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hy.domain.GameGobangRecord;
import com.hy.service.GameGobangRecordService;
import com.hy.mapper.GameGobangRecordMapper;
import org.springframework.stereotype.Service;

/**
* @author hou
* @description 针对表【game_gobang_record(五子棋对局信息)】的数据库操作Service实现
* @createDate 2023-04-16 15:12:05
*/
@Service
public class GameGobangRecordServiceImpl extends ServiceImpl<GameGobangRecordMapper, GameGobangRecord>
    implements GameGobangRecordService{

    @Override
    public IPage listPageByUser(Long id, int page, int size) {
        IPage<GameGobangRecord> iPage = new Page<GameGobangRecord>();

        Wrapper<GameGobangRecord> wrapper = new LambdaQueryWrapper<GameGobangRecord>()
                .eq(GameGobangRecord::getPlayer1, id).or()
                .eq(GameGobangRecord::getPlayer2, id);
        baseMapper.selectPage(iPage, wrapper);
        return iPage;
    }
}




